/*************************************************************************
*	Copyright (c) 1989-1992 Stone Design Corp.  All rights reserved. 
*	programmer:	Andrew C. Stone
*	File name:	Quadric.m
*	Date:		May 24 1992 
*	Purpose:	Round up stuff that all quadrics seem to share 
***************************************************************************/
#import <3dreality_api.h>

@implementation Quadric
- init
{
    [super init];
    return self;
}

////////////////////////////////////////////////////////////////////
//			Get/Set
///////////////////////////////////////////////////////////////////

- (RtFloat)radius
{
    return radius;
}

- (RtFloat)zMax
{
    return zMax;
}

- (RtFloat)zMin
{
    return zMin;
}

- (RtFloat)thetaMax
{
    return thetaMax;
}


- setRadius:(RtFloat *)r
{
    radius = r?*r:0.;
    [self calcBoundingBox];
    return self;
}

- setThetaMax:(RtFloat *)tmax
{
    thetaMax = tmax?*tmax:0.;
    [self calcBoundingBox];
    return self;
}

- setZMax:(RtFloat *)z
{
    zMax = z?*z:0.;
    [self calcBoundingBox];
    return self;
}

- setZMin:(RtFloat *)z
{
    zMin = z?*z:0.;
    [self calcBoundingBox];
    return self;
}


////////////////////////////////////////////////////////////////////
//			Archive
///////////////////////////////////////////////////////////////////

- read:(NXTypedStream *)stream
{
    [super read:stream];
    NXReadTypes(stream,"ffff",&radius,&zMin,&zMax,&thetaMax);
    return self;
}


- write:(NXTypedStream *)stream
{
    [super write:stream];
    NXWriteTypes(stream,"ffff",&radius,&zMin,&zMax,&thetaMax);
    return self;
}
@end
